package cn.anosi.repository.test2;

import cn.anosi.entity.test2.OrdersProduct;
import cn.anosi.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by lys on 2017/7/10.
 */
public interface OrdersProductRepository extends BaseRepository<OrdersProduct, Integer>{

    public OrdersProduct queryById(Integer id);

    @Query(value="select t from OrdersProduct t left join fetch t.orders o left join fetch t.product p where o.id = ?")
    public List<OrdersProduct> findByOrder(Integer id);
}
